package com.kjj.gift.clients;

import com.kjj.gift.domain.LoginUser;
import com.kjj.gift.dto.LoginUserMealDto;
import com.kjj.gift.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LoginUserClientFallbackFactory implements FallbackFactory<LoginUserClient> {
    @Override
    public LoginUserClient create(Throwable throwable) {
        return new LoginUserClient() {
            @Override
            public AjaxResult addLoginUserMeal(LoginUserMealDto loginUserMealDto) {
                return AjaxResult.me().setSuccess(false).setMessage("后台服务被熔断了....");
            }

            @Override
            public AjaxResult saveUser(LoginUser loginUser) {
                return AjaxResult.me().setSuccess(false).setMessage("用户注册服务被熔断了....");
            }

            @Override
            public AjaxResult oauthTest(Long id) {
                return AjaxResult.me().setSuccess(false).setMessage("oauth服务被熔断了....");
            }
        };
    }
}
